package com.vates.vsp.practico.commons;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;

public class StringConverter implements Converter {

	@Override
	public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
		arg2.toString().toUpperCase();
		return arg2.trim();
	}

	@Override
	public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
		if (!(arg2 instanceof String)) {
			return null;
		} else {
			arg2.toString().toUpperCase();
			return arg2.toString().trim();
		}
	}
}
